package com.to8to.autotask;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.to8to.autotask.util.DBUtil;

public class ShowTables
{
    public static void main(String[] args) throws SQLException, ClassNotFoundException
    {
        List<String> crmtestList = new ArrayList<String>();
        List<String> crm211List = new ArrayList<String>();

        Connection connect = DBUtil.getConnection();
        Statement stat = connect.createStatement();
        ResultSet result = stat.executeQuery("show tables");
        while (result.next())
            crmtestList.add(result.getString(1));

        DBUtil.releaseSource(result, stat, connect);

        Class.forName("com.mysql.jdbc.Driver");
        connect =
            DriverManager.getConnection("jdbc:mysql://192.168.1.57:3306/crm211?characterEncoding=utf-8&allowMultiQueries=true", "crm", "123456");
        stat = connect.createStatement();
        result = stat.executeQuery("show tables");
        while (result.next())
            crm211List.add(result.getString(1));

        DBUtil.releaseSource(result, stat, connect);

        System.out.println(crmtestList.size());
        System.out.println(crm211List.size());

        for (String tableName : crmtestList)
        {
            if (!crm211List.contains(tableName))
                System.out.println(tableName);
        }

        System.out.println("====================================");

        for (String tableName : crm211List)
        {
            if (!crmtestList.contains(tableName))
                System.out.println(tableName);
        }

    }
}
